home *** CD-ROM | disk | FTP | other *** search
-
- /*
- コンピューターのターンのサブルーチンの戦闘のサブルーチン
-
- By 五味
-
- */
-
-
- #include <stdio.h>
- #include <sub.h>
-
- extern int o,j,i,k[],hp[],s[],thp,b;
- extern char c,*nn[];
-
- struct attack
- {
- char *how;
- int damage;
- };
-
- #include "at_ptn.dat"
-
- battle()
- {
- while( 0 == 0 )
- {
-
- o = random(3);
-
- if( o==0 )
- {
- o = random(10);
- printf(atmes[b*(j+1)*10+o].how,nn[j+b*20],nn[k[i]]);
- getch();
- hp[i] -= atmes[b*(j+1)*10+o].damage;
-
- if( hp[i] < 1 )
- {
- printf("\t%sは死にました…。\n\n",nn[k[i]]);
- getch();
- k[i] = -1;
- return(0);
- }
-
- }
- else
- {
-
- if( hp[i]+random(5) < (thp/5) )
- {
- printf("\t%sは逃走を試みました。\n",nn[k[i]]);
- getch();
-
- if( s[k[i]]+random(10) > s[j] )
- {
- printf("\n %sは、うまく逃げのびたようです。\n\n",nn[k[i]]);
- getch();
- return(0);
- }
- else
- {
- printf("\tしかし、逃げる隙をうかがえなかったようです。\n\n");
- getch();
- }
-
- }
- else
- {
- o = random(10);
- printf(atmes[o].how,nn[k[i]],nn[j+20*b]);
- getch();
- thp -= atmes[o].damage;
-
- if( thp < 1 )
- {
- printf("\n %sを倒しました。\n\n",nn[j+20*b]);
- getch();
- return(1);
- }
- }
-
- }
- }
- }
-